interface State {
  auid: string
  count: number
}

const state: State = {
  auid: 'audit',
  count: 0,
}

const getters: GetterTree<State, State> = {
  count(state) {
    return state.count++
  },
}

const mutations: MutationTree<State> = {
  ['MT_CHANGE_UID'](state, payload: { auid: string }): void {
    state.auid = payload.auid
  },
}

const actions: ActionTree<State, State> = {
  appChangeUid({ commit, dispatch }, payload: { auid: string }) {
    dispatch(
      'login/loginChangeUid',
      { luid: 'fjskdlfjdklfjkls' },
      { root: true },
    )

    setTimeout(() => {
      commit('MT_CHANGE_UID', payload)
    }, 2000)
  },
}
export default {
  namespaced: true,
  state,
  getters,
  mutations,
  actions,
}
